Need Help with Pandas-DataReader Not Connecting

by: sm31204, 7 years ago


So I'm new here folks and have hit the wall off the bat. I was following along with lesson 2 of "Intro and Getting Stock Price Data - Python Programming for Finance" by sentdex on YouTube "https://www.youtube.com/watch?v=2BrpKpWwT2A". I've installed numpy, pandas and pandas-datareader current versions successfully. Beautifulsoup4 came with new python3.5 install this morning. My code compiles but crashes when trying to open connection it appears. Can anyone advise?

import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web
style.use('ggplot')
start = dt.datetime(2000,1,1)
end = dt.datetime(2016,12,31)
df = web.DataReader('TSLA', 'yahoo', start, end)
print(df.head())

The errors I see are (of course followed by other errors during handling):
Traceback (most recent call last): File "C:UsersSAppLocalProgramsPythonPython35libsite-packagesurllib3connection.py", line 141, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "C:UsersSAppLocalProgramsPythonPython35libsite-packagesurllib3utilconnection.py", line 60, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "C:UsersSAppLocalProgramsPythonPython35libsocket.py", line 728, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 11001] getaddrinfo failed



You must be logged in to post. Please login or register an account.



The yahoo api has been removed, you'll have to use google instead, or use the fix-yahoo-finance module: https://pypi.python.org/pypi/fix-yahoo-finance

-Harrison 7 years ago

You must be logged in to post. Please login or register an account.

Thank you Harrison, that worked!

-sm31204 7 years ago

You must be logged in to post. Please login or register an account.